/*
* 07_02_2014
*/
package com.example.mt3d;

import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class Aumentada extends Activity {

	private Camera camera;
	private boolean isCameraOn;
	private boolean hasCamera;
	Parameters params;
	private Button btncamera;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_aumentada);
		btncamera = (Button)findViewById(R.id.imageButton1);
	}
	
	private void getCamera(){
		if (camera == null){
			try{
				camera = Camera.open();
				params = camera.getParameters();
			}catch(RuntimeException e){
				Log.e("Camara Error",e.getMessage());
			}
		}
	}
	
	public void turnOnCamera(){
		if(!isCameraOn){
			if( camera == null || params == null){
				return;
			}
			params = camera.getParameters();
			params.setFocusMode(params.FOCUS_MODE_CONTINUOUS_PICTURE);
			camera.setParameters(params);
			camera.startPreview();
			isCameraOn = true;
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.aumentada, menu);
		return true;
	}

}